package com.jdyinfo.ic.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jdyinfo.ic.mysql.entity.Unit;
import com.jdyinfo.ic.mysql.mapper.UnitMapper;

@Service("unitService")
public class UnitService {
	@Autowired
	UnitMapper unitMapper;
	
	public List<Unit> findUnit(int buildingId) {
		return unitMapper.findUnitByBuildingId(buildingId);
	}
	
	public int createUnit(Unit unit) {
		return unitMapper.insertOne(unit);
	}
	
	public int updateUnit(Unit unit) {
		return unitMapper.updateOne(unit);
	}
	
	public int deleteUnit(int id) {
		return unitMapper.deleteOne(id);
	}
	
}
